import UIKit
import Flutter
import WebKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    
    checkSafairBrowserCookie();
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

func checkSafairBrowserCookie(){
    let dataStore = WKWebsiteDataStore.default()
    dataStore.fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) {websiteDataRecords in
        for dataRecord in websiteDataRecords {
            print("\(dataRecord)")
          
        }
    }
    
    dataStore.httpCookieStore.getAllCookies { cookies in
        for cookie in cookies {
            print(cookie)
        }
    }
}
 

/**
 <NSHTTPCookie
     version:1
     name:BAIDUID
     value:C77E12CF0ABE2AF3D07EE898A2924EBB:FG=1
     expiresDate:'2022-07-26 6:54:39 AM +0000'
     created:'2021-07-26 6:54:39 AM +0000'
     sessionOnly:FALSE
     domain:.baidu.com
     partition:none
     sameSite:none
     path:/
     isSecure:FALSE
  path:"/" isSecure:FALSE    comment:bd
 >
 <NSHTTPCookie
     version:1
     name:H_WISE_SIDS
     value:107312_110085_127969_128698_164870_168389_175755_176121_176677_177167_177412_177954_178006_178139_178330_178529_178635_179200_179347_179402_179441_179485_179534_180327_180410_180434_180435_180655_180699_180752_180753_180822_180855_180869_180888_180890_180932_181219_181251_181262_181321_181329_181401_181427_181433_181484_181535_181584_181587_181628_181808_181833_181862_181926_182024_182119_182193_182251_182273_182366_182384_182411_182427
     expiresDate:'2022-07-26 8:39:01 AM +0000'
     created:'2021-07-26 8:39:02 AM +0000'
     sessionOnly:FALSE
     domain:.baidu.com
     partition:none
     sameSite:none
     path:/
     isSecure:FALSE
  path:"/" isSecure:FALSE>
 <NSHTTPCookie
     version:1
     name:cookieName
     value:cookieValue
     expiresDate:'2021-08-05 8:14:18 AM +0000'
     created:'2021-07-26 8:14:18 AM +0000'
     sessionOnly:FALSE
     domain:localhost
     partition:none
     sameSite:none
     path:/
     isSecure:FALSE
  path:"/" isSecure:FALSE>
 <NSHTTPCookie
     version:1
     name:cookieName1
     value:cookieValue1
     expiresDate:'2021-08-05 8:24:06 AM +0000'
     created:'2021-07-26 8:24:06 AM +0000'
     sessionOnly:FALSE
     domain:www.baidu.com
     partition:none
     sameSite:none
     path:/
     isSecure:FALSE
  path:"/" isSecure:FALSE>
 <WKWebsiteDataRecord: 0x283b16b50; displayName = baidu.com; dataTypes = { Disk Cache, Cookies }>
 <WKWebsiteDataRecord: 0x283b17560; displayName = bdimg.com; dataTypes = { Disk Cache }>
 <WKWebsiteDataRecord: 0x283b176b0; displayName = localhost; dataTypes = { Cookies }>
 <WKWebsiteDataRecord: 0x283b175d0; displayName = bdstatic.com; dataTypes = { Disk Cache }>
 */
